package com.yupi.springbootinit.demo;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class QueryConServiceImpl implements QueryConfigurationsService{
    @Resource
    private SqlSession sqlSession;
    @Resource
    private querys querys;

    private static final int TOTAL_RECORDS = 10;

    public void query(){
//        Map<String, QueryConfigurations.TableConfiguration> configurations = queryConfigurations.getConfigurations();
//        System.out.println(configurations.values());

//        int recordsPerTable = TOTAL_RECORDS / configurations.size();
//        List<String> tableSQLs = new ArrayList<>();


//        for (QueryConfigurations.TableConfiguration config : configurations.values()) {
//            System.out.println(config);
////            tableSQLs.add(generateSQL(config.getTableName(), config.getFields(), recordsPerTable));
//        }


    }

    private String generateSQL(String tableName, List<String> fields, int limit) {
        return "SELECT " + String.join(", ", fields) + " FROM " + tableName + " LIMIT " + limit;
    }


}
